import { createRouter, createWebHashHistory } from "vue-router";

const routes = [
  {
    path: "/",
    redirect: "/home",
  },
  {
    path: "/home",
    component: () => import("../views/Home.vue"),
    children: [
      {
        path: "/home",
        redirect: "/home/index",
      },
      {
        path: "/home/index",
        component: () => import("../views/Home/Index.vue"),
      },
      {
        path: "/home/seeDoctor/:name",
        component: () => import("../views/Home/SeeDoctor.vue"),
        props: true,
      },
      {
        path: "/home/healthNew",
        component: () => import("../views/Home/HealthNew.vue"),
        children: [
          {
            path: "/home/healthNew",
            redirect: "/home/healthNew/doctorsay",
          },
          {
            path: "/home/healthNew/doctorsay",
            component: () => import("../views/Home/healthNew/doctorsay.vue"),
          },
          {
            path: "/home/healthNew/recommend",
            component: () => import("../views/Home/healthNew/recommend.vue"),
          },
          {
            path: "/home/healthNew/broadcast",
            component: () => import("../views/Home/healthNew/broadcast.vue"),
          },
        ],
      },
      {
        path: "/home/healthMall",
        component: () => import("../views/Home/HealthMall.vue"),
      },
      {
        path: "/home/mine",
        component: () => import("../views/Home/Mine.vue"),
      },
      {
        path: "/home/detail/:id",
        component: () => import("../views/Home/Detail.vue"),
        props: true,
      },
    ],
  },
  // 我的页面下的健康VIP
  {
    path: "/home/mine/healthVip",
    component: () => import("../views/Home/mine/HealthVip.vue"),
  },
  {
    path: "/home/seeDoctor/allDepartments",
    component: () => import("../views/Home/seeDoctor/allDepartments.vue"),
  },
  {
    // 首页-去挂号
    path: "/registration",
    component: () => import("../views/Registration.vue"),
  },
  {
    // 首页-问专家
    path: "/expert",
    component: () => import("../views/Expert.vue"),
  },
  {
    // 首页-专科频道
    path: "/specialized",
    component: () => import("../views/Specialized.vue"),
  },
  {
    // 首页-极速咨询
    path: "/consult",
    component: () => import("../views/Consult.vue"),
  },
  {
    // 首页-在家购药
    path: "/buymedicine",
    component: () => import("../views/BuyMedicine.vue"),
  },
  // 我的页面下的我的钱包
  {
    path: "/home/mine/wallet",
    component: () => import("../views/Home/mine/Wallet.vue"),
  },
  // 我的页面下404notfound
  {
    path: "/home/mine/404notfound",
    component: () => import("../views/Home/mine/404notfound.vue"),
  },
  //二维码
  {
    path: "/home/mine/erweima",
    component: () => import("../views/Home/mine/erweima.vue"),
  },
  // 登录页面
  {
    path: "/home/mine/login",
    component: () => import("../views/Home/mine/login.vue"),
  },
  // 寻医-全部科室选择
  {
    path: "/home/seeDoctor/allDepartments",
    component: () => import("../views/Home/seeDoctor/allDepartments.vue"),
  },
  {
    //寻医-全部科室医生列表
    path: "/doctorList/:ksid",
    component: () => import("../views/departmentsDoctorList.vue"),
    props: true,
  },
  //寻医-城市
  {
    //一元义诊
    path: "/home/diagnosis",
    component: () => import("../views/Home/Diagnosis.vue"),
  },
  {
    //名医诊室
    path: "/home/consultation",
    component: () => import("../views/Home/WorkOffer.vue"),
  },
  {
    path: "/home/city",
    component: () => import("../views/Home/seeDoctor/city.vue"),
  },
  {
    //一元义诊
    path: "/home/diagnosis",
    component: () => import("../views/Home/Diagnosis.vue"),
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
